﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class QuestScript : MonoBehaviour
{
    public Quest MyQuest { get; set; }
    
    private bool completeMarked = false;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        
    }
    public void Select()
    {
       
        GetComponentInChildren<Text>().color = new Color32(16, 0, 191, 255);
        QuestLog.MyInstance.ShowDesc(MyQuest);
    }
    public void Deselect()
    {
       
        GetComponentInChildren<Text>().color = new Color32(5, 0, 63, 255);
    }
    public void QuestDone()
    {
        if (MyQuest.MyIsComplete&&!completeMarked)
        {
            completeMarked = true;
            GetComponentInChildren<Text>().text += " - ✓";

        }
        else if(!MyQuest.MyIsComplete)
        {
            completeMarked = false;
            GetComponentInChildren<Text>().text=MyQuest.MyTitle;
        }//if failed ✕

    }
}
